import { createRouter, createWebHistory } from 'vue-router'
import GradeView from '../views/grade/GradeView.vue'
import GradeListView from '../views/grade/GradeListView.vue'
import GradeAddView from '../views/grade/GradeAddView.vue'
import GradeUpdateView from '../views/grade/GradeUpdateView.vue'
import StudentView from '../views/student/StudentView.vue'
import StudentListView from '../views/student/StudentListView.vue'
import StudentAddView from '../views/student/StudentAddView.vue'
import StudentUpdateView from '../views/student/StudentUpdateView.vue'
import SubjectView from '../views/subject/SubjectView.vue'
import SubjectListView from '../views/subject/SubjectListView.vue'
import SubjectAddView from '../views/subject/SubjectAddView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/grade',
      name: 'grade',
      component: GradeView,
      redirect:{
        path:'/grade/list'
      },
      children:[
        {
          path:'list',
          component:GradeListView
        },
        {
          path:'add',
          component:GradeAddView
        },
        {
          path:'update/:id',
          name:'gradeupdate',
          component:GradeUpdateView
        }
      ]
    },
    {
      path: '/student',
      name: 'student',
      component: StudentView,
      redirect:{
        path:'/student/list'
      },
      children:[
        {
          path:'list',
          component:StudentListView
        },
        {
          path:'add',
          component:StudentAddView
        },
        {
          path:'update/:id',
          name:'studentupdate',
          component:StudentUpdateView
        }
      ]
    },
    {
      path: '/subject',
      name: 'subject',
      component: SubjectView,
      redirect:{
        path:'/subject/list'
      },
      children:[
        {
          path:'list',
          component:SubjectListView
        },
        {
          path:'add',
          component:SubjectAddView
        },
      ]
    },
  ]
})

export default router
